import mergeLog from '@/models/mergeLog';
// 查询
export const getMergeLogList = async (params: { author?: string; createAt?: string; page?: number; pageSize?: number }) => {
  const temp: any = {};
  const { author, createAt, page, pageSize } = params;
  if (createAt) {
    temp.createAt = {
      $gte: new Date(`${createAt} 00:00:00`).getTime(),
      $lte: new Date(`${createAt} 23:59:59`).getTime(),
    };
  }
  if (author) {
    temp.author = new RegExp(author);
  }
  const res: any = await mergeLog.getList(temp, { createAt: -1, author: 1, name: 1, branch: 1 }, page, pageSize);
  return res;
};
